﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace SoilProfiler
{
    public partial class uxNewProject : Form
    {
        public uxNewProject()
        {
            InitializeComponent();
        }

        public string Projection { set; get; }

        private void uxFolder_Click(object sender, EventArgs e)
        {
            string folderPath = "";
            FolderBrowserDialog folderBrowserDialog1 = new FolderBrowserDialog();
            if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
            {
                folderPath = folderBrowserDialog1.SelectedPath;
                uxFolder.Text = folderPath;
            }


        }

        private void uxAccept_Click(object sender, EventArgs e)
        {
            if (uxName.Text == "")
            {
                MessageBox.Show("Name project empty");
                return;
            }
            if (uxFolder.Text == "")
            {
                MessageBox.Show("Path empty");
                return;
            }
            else
            {
                if (!Directory.Exists(uxFolder.Text))
                {
                    MessageBox.Show("Path does not exist");
                    return;
                }

            }
            if (Projection == "")
            {
                MessageBox.Show("Please configure projection");
                return;
            }




            Close();
        }

        private void uxProjection_Click(object sender, EventArgs e)
        {
            ProjectionDatum p = new ProjectionDatum();
            if (p.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Projection = p.Projection;
            }
        }
    }
}
